package mx.beans;

import java.util.LinkedList;
import java.util.List;

import mx.util.GameParser;

public class Game {
	
	private String id;
	private String price;
	private String publisher;
	private String genre;
	private String releaseDate;
	private String name;
	private String about;
	private String clasification;
	private List<Console> consoles;
	private List<Portrait> portraits;
	private List<Image> images;
	private List<Video> videos;
	
	//Variables "para el parser"
	private String gameDetailURL;
	private int source;
	
	public Game(String id, String price, String publisher, String genre, 
			String gameDetailURL, String name, String clasification, 
			List<Console> consoles) {
		this.id = id;
		this.price = price;
		this.publisher = publisher;
		this.genre = genre;
		this.name = name;
		this.clasification = clasification;
		
		//Iniciando listas
		this.consoles = consoles; 
		this.portraits = new LinkedList<Portrait>();
		//TODO considerar si no debería ser un hashmap
		//razón: Quiero la portada de playstation, con lista O(n), con HM O(1)
		//pero más memoria
		
	}
	
	/**
	 * @return the releaseDate
	 */
	public String getReleaseDate() {
		
		if((this.releaseDate == null) || (releaseDate.equals(""))) {
			GameParser.getDetailedInfo(this);
		}

		return this.releaseDate;
	}
	
	/**
	 * @return the about
	 */
	public String getAbout() {
		
		if((this.about == null) || (about.equals(""))) {
			GameParser.getDetailedInfo(this);
		}

		return this.about;
		
	}
	
	public void addPortrait(String urlPortrait, Console console) {
		this.portraits.add(new Portrait(urlPortrait, console));
	}
	
	public String getGameDetailURL() {
		return gameDetailURL;
	}
	
	public void setAbout(String about) {
		this.about = about;
	}
	
	public void setReleaseDate(String releaseDate) {
		this.releaseDate = releaseDate;
	}
	
	public int getSource() {
		return source;
	}
	
	public void setSource(int source) {
		this.source = source;
	}
	
	public List<Image> getImages() {
		if(this.images == null) {
			GameParser.getImages(this);
		}
		
		return this.images;
	}
	
	public void setImages(List<Image> images) {
		this.images = images;
	}

	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getPrice() {
		return price;
	}
	
	public void setPrice(String price) {
		this.price = price;
	}
	
	public String getPublisher() {
		return publisher;
	}
	
	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}
	
	public String getGenre() {
		return genre;
	}
	
	public void setGenre(String genre) {
		this.genre = genre;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getClasification() {
		return clasification;
	}
	
	public void setClasification(String clasification) {
		this.clasification = clasification;
	}
	
	public void setConsoles(List<Console> consoles) {
		this.consoles = consoles;
	}
	
	public List<Console> getConsoles() {
		return consoles;
	}
	
	public List<Video> getVideos() {
		return videos;
	}
	
	public void setVideos(List<Video> videos) {
		this.videos = videos;
	}
}
